package cn.nju.zyy.persistence;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.hibernate.ejb.Ejb3Configuration;

public class JPAUtil {

	private static final EntityManagerFactory emf;
	
	static {
		try {
			emf = Persistence.createEntityManagerFactory("helloworld");
		} catch (Throwable e) {
			System.err.println("Initial SessionFactory creation failed." + e);
			throw new ExceptionInInitializerError(e);
		}
	}
	
	public static EntityManagerFactory getEntityManagerFactory() {
		return emf;
	}

	public static void shutdown() {
		emf.close();
	}
}
